//
//  CoworkerAskCell.m
//  MyProject
//
//  Created by 石小强 on 2018/3/23.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "CoworkerAskCell.h"

@implementation CoworkerAskCell

- (void)setModel:(WorkmateModel *)model {
    _model = model;
    
    [self.headerIV sd_setImageWithURL:ImageURLWithKey(model.headImg) placeholderImage:PlaceholderImage];
    self.nameL.text = model.nickName;
    self.positionL.text = [NSString stringWithFormat:@"-%@", model.positionName];
    self.yearCountL.text = [NSString stringWithFormat:@"已在职%@年 | 帮助过%@人", model.inServiceTime, model.helpedCount];
    self.satisfactionL.text = [NSString stringWithFormat:@"满意度%.0f%@", [model.degreeOfSatisfaction floatValue]*100,@"%"];
    
    self.selectBtn.selected = model.isselect == 1 ? YES : NO;
}

- (IBAction)selectBtnClick:(id)sender {
    self.selectBtn.selected = !self.selectBtn.selected;
    if (self.selectBtn.selected) {
        self.model.isselect = 1;
    } else {
        self.model.isselect = 0;
    }
    if ([self.delegate respondsToSelector:@selector(selectBtnClickWithModel:andIndex:andIsSelect:)]) {
        [self.delegate selectBtnClickWithModel:self.model andIndex:self.index andIsSelect:self.selectBtn.selected ? 1 : 0];
    }
}


@end
